<?php
include('includes/db_connect.php');
if(false) {

} else {
	$dateMonth = date("m", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	$dateDay = date("d", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	$dateYear = date("Y", mktime(date("H"),date("i"),date("s"),date("m"), date("d"), date("Y")));
	$citizen = 1;
}


?>
<form action="actions/irEdit.php" method="post">
<div style="border:1px #ddd solid;padding:3px;">
	<h2>Information and Referral Entry</h2>

	<table class="table2">
    <tr>
      <td colspan="2"><div class="formUnitVertical">
          <label for="date">Date</label>
          <br/>
          <select name="dateMonth" id="dateMonth">
            <option value="01">January</option>
            <option value="02">February</option>
            <option value="03">March</option>
            <option value="04">April</option>
            <option value="05">May</option>
            <option value="06">June</option>
            <option value="07">July</option>
            <option value="08">August</option>
            <option value="09">September</option>
            <option value="10">October</option>
            <option value="11">November</option>
            <option value="12">December</option>
          </select>
          <script>					
						for(i=0; i<$('dateMonth').options.length; i++) {
							if($('dateMonth').options[i].value=='<? echo $dateMonth ?>') {
								$('dateMonth').options[i].selected = true;
							}
						}
					</script>
          <select name="dateDay" id="dateDay">
            <?php 
						for($i=1; $i<32; $i++) {
							if($i<10)
								echo "<option value=\"0".$i."\">".$i."</option>";
							else
								echo "<option value=\"".$i."\">".$i."</option>";
						}?>
          </select>
          <script>					
						for(i=0; i<$('dateDay').options.length; i++) {
							if($('dateDay').options[i].value=='<? echo $dateDay ?>') {
								$('dateDay').options[i].selected = true;
							}
						}
					</script>
          <select name="dateYear" id="dateYear">
            <?php
						
						for($i=0; $i<10; $i++) {
							$year = date("Y", mktime(0,0,0,1,1,date("Y")-$i));
							echo "<option value=\"".$year."\">".$year."</option>";
						}?>
          </select>
          <script>					
						for(i=0; i<$('dateYear').options.length; i++) {
							if($('dateYear').options[i].value=='<? echo $dateYear ?>') {
								$('dateYear').options[i].selected = true;
							}
						}
					</script>
        </div>
      </td>
      <td align="left" colspan="2">
      	<div class="formUnitVertical" style="text-align:right">
          <label for="date">Minutes</label><br/>
          
          <input type="text" name="minutes" value="<?php echo $minutes; ?>" width="3" style="width:60px"/>
        </div>
    	</td>
  	</tr>
    <tr>
    	<td colspan="4"/>
    </tr>
    <tr>
    	<td colspan="4">
      	<div class="formUnit">
          <label for="type" style="width:80px">Type:</label>
          <select name="irType" style="width:500px">
            <?php 
              $irQuery = "select * from lst_ir_type";
              $result = mysql_query($irQuery);
              while($row=mysql_fetch_array($result)) {
                $type_id = $row["id"];
                $type = $row["type"];
                if($irType==$type_id)
                  echo "<option value=\"".$type_id."\" selected>".$type."</option>";
                else
                  echo "<option value=\"".$type_id."\">".$type."</option>";
              }
            ?>
          </select>
        </div>
      </td>
    </tr>
    <tr>
    	<td colspan="4"/>
    </tr>
    <tr>
    	<th></th>
      <th>Information</th>
      <th>Agency</th>
      <th>Minutes</th>
    </tr>
    <tr>
    	<td>
      	<div class="checkBoxUnit">
          <input type="checkbox" name="sent" <?php if($sent=="1") echo "checked";?>/>
          <label for="sent">Sent </label>
          
        </div>
      </td>
      <td>
      	<div class="formUnitVertical">          
          <input type="text" name="sentInfo" value="<?php echo $sentInfo; ?>"/>
        </div>
      </td>
      <td>
      	<div class="formUnitVertical">          
          <input type="text" name="sentAgency" value="<?php echo $sentAgency; ?>"/>
        </div>
      </td>
      <td>
      	<div class="formUnitVertical">          
          <input type="text" name="sentMinutes" value="<?php echo $sentMinutes; ?>" width="3" style="width:60px"/>
        </div>
      </td>      
    </tr>
    <tr class="odd">
    	<td>
      	<div class="checkBoxUnit">
          <input type="checkbox" name="refer" <?php if($refer=="1") echo "checked";?>/>
          <label for="refer">Refer</label>
          
        </div>
      </td>
      <td>
      	<div class="formUnitVertical">          
          <input type="text" name="referInfo" value="<?php echo $referInfo; ?>"/>
        </div>
      </td>
      <td>
      	<div class="formUnitVertical">          
          <input type="text" name="referAgency" value="<?php echo $referAgency; ?>"/>
        </div>
      </td>
      <td>
      	<div class="formUnitVertical">          
          <input type="text" name="referMinutes" value="<?php echo $referMinutes; ?>" width="3" style="width:60px"/>
        </div>
      </td>
    </tr>
    <tr>
    	<td>
      	<div class="checkBoxUnit">
          <input type="checkbox" name="info" <?php if($info=="1") echo "checked";?>/>
          <label for="info">Info </label>
          
        </div>
      </td>
      <td>
      	<div class="formUnitVertical">          
          <input type="text" name="infoInfo" value="<?php echo $infoInfo; ?>"/>
        </div>
      </td>
      <td>
      	<div class="formUnitVertical">          
          <input type="text" name="infoAgency" value="<?php echo $infoAgency; ?>"/>
        </div>
      </td>
      <td>
      	<div class="formUnitVertical">          
          <input type="text" name="infoMinutes" value="<?php echo $infoMinutes; ?>" width="3" style="width:60px"/>
        </div>
      </td>
    </tr>
    <tr>
    	<td valign="top" colspan="4"><label>Notes:</label><br/><br/>
      <textarea name="services" cols="115" rows="10"><?php echo $notes ?></textarea></td>
    </tr>
  </table>
</div>
</form>